package com.thf.controller;

import com.thf.model.PageModel;
import com.thf.model.ResultData;
import com.thf.service.UserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/userFindAll")
    public ResultData userFindAll(@RequestBody PageModel pageModel){
        return userService.userFindAll(pageModel);
    }
    @RequestMapping("/userFind")
    public ResultData userFind(Integer startPage, Integer pageSize,@RequestBody Map map){
        return userService.userFind(startPage,pageSize,map);
    }
    @RequestMapping("/getCount")
    public Integer getCount(@RequestBody Map map){
        return userService.getCount(map);
    }
    @RequestMapping("/add")

    public ResultData add(@RequestBody Map map){
        return userService.add(map);
    }
    @RequestMapping("/delete")

    public ResultData delete(Integer stringToInt){
        return userService.delete(stringToInt);
    }
    @RequestMapping("/getUserById")

    public ResultData getUserById(Integer stringToInt){
        return userService.getUserById(stringToInt);
    }
    @RequestMapping("/update")

    public ResultData update(@RequestBody Map map){
        return userService.update(map);
    }
    @RequestMapping("/updateEnadle")

    public ResultData updateEnadle(String id){
        return userService.updateEnadle(id);
    }
//    public ResultData defaultFallback(){
//        return new ResultData(1,"默认提示：对不起，网络太拥挤了！");
//    }
}
